//
//  EpointTestPanel.m
//  EpointMobileShell
//
//  Created by 李亚春 on 14-1-7.
//  Copyright (c) 2014年 Epoint. All rights reserved.
//

#import "EpointTestPanel.h"
#import "MMGridViewDefaultCell.h"
#import "MMGridViewCell.h"
#import "EpointMMIconCell.h"

@interface EpointTestPanel ()
{
    MMGridView *mg;
}
@end

@implementation EpointTestPanel

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        self.title = @"测试";
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    mg = [[MMGridView alloc]initWithFrame:self.view.bounds];
    mg.delegate = self;
    mg.dataSource = self;
    mg.cellMargin = 15;
    mg.numberOfRows = 4;
    mg.numberOfColumns = 3;
    mg.layoutStyle = VerticalLayout;
    [self.view addSubview:mg];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(MMGridViewCell *)gridView:(MMGridView *)gridView cellAtIndex:(NSUInteger)index
{
    EpointMMIconCell *cell = [[EpointMMIconCell alloc]initWithFrame:CGRectNull image:@"contacts" title:@"通讯录"];
    return cell;
}

- (NSInteger)numberOfCellsInGridView:(MMGridView *)gridView
{
    return 14;
}

-(void)gridView:(MMGridView *)gridView didSelectCell:(MMGridViewCell *)cell atIndex:(NSUInteger)index
{
    NSLog(@"%@",[NSString stringWithFormat:@"%i",index]);
}

@end
